<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加员工</title>
    <link rel="stylesheet" href="../../layui/css/layui.css">
    <link rel="stylesheet" href="../../css/iconfont.css">
    <link rel="stylesheet" href="../../css/base.css">
    <script src="../../js/jquery-1.11.0.js"></script>
    <script src="../../layui/layui.js"></script>
    <script src="../../js/frameAll.js"></script>
    <style>
        .layui-form {
            margin-top: 30px;
            margin-right: 50px;
        }
    </style>
    <script type="text/javascript">
        function getInfo() {
            var info;
            layui.use('form', function () {
                var form = layui.form;
                info = form.val('infoForm');
            });
            return info;
        }

        function setInfo(comployeeNo) {
            layui.use('form', function () {
                var form = layui.form;
                $.ajax({
                    type: "get",
                    url: "/fixedAsset/comployee/select.do",
                    data: {comployeeNo: comployeeNo},
                    dataType: "Json",
                    success: function (data) {
                        if (data.code === 0) {
                            form.val('infoForm', {
                                comployeeNo: data.data.comployeeNo,
                                comployeeName: data.data.comployeeName,
                                age: data.data.age,
                                dept: data.data.dept,
                                sex: data.data.sex,
                                profession: data.data.profession,
                                phone: data.data.phone,
                                address: data.data.address,
                            });
                            form.render();
                        } else {
                            noMsg(data.message);
                        }
                    },
                    error: function () {
                        // top.location.href = "../../login.html";
                    }
                });
            });
        }

        layui.use(['table', 'form'], function () {
            var form = layui.form;
            //获取部门列表
            $.ajax({
                type: 'get',
                url: '/fixedAsset/comployee/deptList.do',
                dataType: "Json",
                success: function (data) {
                    for (let i = data.length - 1; i >= 0; i--) {
                        $('select').append(new Option(data[i].dept, data[i].dept));
                    }
                    form.render('select');
                }
            });
        });
    </script>
</head>
<body>
<div class="cBody">
    <form class="layui-form" lay-filter="infoForm">
        <input type="hidden" name="comployeeNo">
        <div class="layui-form-item">
            <label class="layui-form-label">姓&emsp;名 : </label>
            <div class="layui-input-inline shortInput">
                <input type="text" name="comployeeName" autocomplete="off" class="layui-input"
                       placeholder="请输入您的姓名" lay-verify="name">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">年&emsp;龄 : </label>
            <div class="layui-input-inline shortInput">
                <input type="text" name="age" autocomplete="off" class="layui-input"
                       placeholder="请输入您的年龄" lay-verify="age">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">部门 : </label>
            <div class="layui-input-inline shortInput">
                <select name="dept">
                    <option value="">选择部门</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">现任职务 : </label>
            <div class="layui-input-inline shortInput">
                <input type="text" name="profession" autocomplete="off" class="layui-input"
                       placeholder="请输入您的职务">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">联系方式 : </label>
            <div class="layui-input-inline shortInput">
                <input type="text" name="phone" autocomplete="off" class="layui-input"
                       placeholder="请输入您的联系方式" lay-verify="phone">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">家庭地址 : </label>
            <div class="layui-input-inline shortInput">
                <input type="text" name="address" autocomplete="off" class="layui-input"
                       placeholder="请输入您的家庭地址" lay-verify="">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">性&emsp;别 : </label>
            <div class="layui-input-block">
                <input type="radio" name="sex" value="男" title="男" checked>
                <input type="radio" name="sex" value="女" title="女">
            </div>
        </div>
    </form>
</div>
</body>
</html>